package com.jzrh.flashbee.common.utils;

import java.security.SecureRandom;
import java.util.Base64;

/**
 * @author Jince
 * @since: 2023.11.23 上午 12:11
 * @description:
 */
public class AccessKeyGenerator {
    private static final int KEY_LENGTH = 64; // 定义密钥长度，可以根据需要进行调整

    public static String generateAccessKey() {
        SecureRandom secureRandom = new SecureRandom();
        byte[] keyBytes = new byte[KEY_LENGTH];
        secureRandom.nextBytes(keyBytes);
        return Base64.getUrlEncoder().withoutPadding().encodeToString(keyBytes);
    }
}
